/**
 * @(#)BuyType.java, 2018/2/2.
 * <p/>
 * Copyright 2018 Kerr Wang, Inc. All rights reserved.
 * KERRWANG PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package org.wangzx.exercise.enums;

/**
 * @author hzwangzuxiang(ahscwzx@163.com)
 */
public enum BuyStateType implements EnumIntegerInterface<BuyStateType>{
    CART(0, "放入购物车"),
    BUY(1, "已购买"),
    ;

    private final int value;

    private final String desc;

    BuyStateType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public int getValue() {
        return value;
    }

    @Override
    public BuyStateType genEnumByIntValue(int intValue) {
        for(BuyStateType buyType : BuyStateType.values()) {
            if(buyType.value == intValue) {
                return buyType;
            }
        }
        return CART;
    }
}
